package com.itheima.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itheima.pojo.Emp;
import com.itheima.pojo.EmpQueryParam;
import org.apache.ibatis.annotations.*;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;

/**
 * 操作员工信息的Mapper
 */
@Mapper
public interface EmpMapper extends BaseMapper<Emp> {
    /**
     * 统计员工职位人数
     */
    @MapKey("pos")
    List<Map> getEmpJobData();

    /**
     * 统计员工性别
     */
    @MapKey("name")
    List<Map<String, Object>> getEmpGenderData();

    /**
     * 根据部门id查询员工人数
     */
    @Select("select count(*) from emp where dept_id = #{deptId}")
    Integer countByDeptId(Integer deptId);

    /**
     * 查询所有的图像访问路径
     */
    @Select("select distinct image from emp where image != '' and image is not null")
    List<String> listFiles();

    /**
     * 根据用户名和密码查询员工信息
     */
    @Select("select * from emp where username = #{username} and password = #{password}")
    Emp getByUsernameAndPassword(Emp emp);
}
